home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_oth / prolgbmk / benchmk.pro < prev    next >
Text File  |  1989-02-11  |  3KB  |  90 lines

  1. /* Prolog benchmark from IEEE Micro 2/89
  2. Last revised:  2/10/89
  3.  
  4. Adapted to Turbo Prolog by:
  5. Chris Petersen
  6. 7600 Penn Ave. S. #202
  7. Richfield, MN 55423
  8. Compuserve:    71046,1214
  9. GENIE:        C.PETERSEN
  10.  
  11. For the full text of the Prolog article see:
  12. IEEE Micro
  13. February 1989, Page 10
  14.  
  15. This program was benchmarked against various Prolog/computer combinations.
  16. A summary of the results follows:
  17.  
  18. Machine            System        Performance (LIPS)    Reference
  19. Xenologic X1        (TTL)/Compiled    200-400K
  20. Berkeley PLM        (TTL)/Compiled    305,000            NCR 9300 Host
  21. IBM 3081        VM/Prolog    200,000            IBM IJCAI
  22. Symbolics 3600        Microcoded    53,000            Cassels
  23. DEC 2060        Warren Compiled    43,000            Warren
  24. Japan's 5th Gen PSI    Microcoded    30,000            Taki
  25. IBM 3033        Waterloo    27,000            Warren
  26. 80286 12 mHz (Est)    Turbo Pro. 2.0    24,700            Petersen
  27. VAX 11/780        Macrocoded    15,000            Est
  28. Sun-2            Quintus Compl    14,000            Warren
  29. V20 10 mHz MS-DOS    Turbo Pro. 2.0    8,300            Petersen
  30. LMI/Lambda        Uppsala        8,000            Warren
  31. IBM XT (Est)        Turbo Pro. 2.0    3,300            Petersen
  32. VAX 11/780        Prolog        2,000            Warren
  33. VAX 11/780        M-Prolog    2,000            Warren
  34. VAX 11/780        C-Prolog    1,500            Warren
  35. Symbolics 3600        Interpreter    1,500            Warren
  36. PDP 11/70        Interpreter    1,000            Warren
  37. Z80            Micro Prolog    120            Warren
  38. Apple II        Interpreter    8            Warren
  39.  
  40. This program requires 0.5*N^2 + 1.5*N + 1 logical inferences.  For a list of
  41. 30 items, 496 logical inferences must be made.  For a run time of 0.06 secs, 
  42. the number of Logical Inferences Per Second (LIPS) is 496/.06 = 8267.
  43.  
  44. The results?  Turbo Prolog stacks up quite well against the competition.  
  45. Running on a 12 mHz 80286 it is faster than all of the implementations tested
  46. on the VAX 11/780.  It is still a factor of 10 slower than the top performing
  47. Prologs.  Not too bad for a microcomputer!
  48.  
  49. Keep in mind, however, that this is a very simple benchmark and does not take
  50. into account other types of programs which are more generally used in the real
  51. world.  It is, however, a very simple and nice comparison tool.
  52. */
  53.  
  54. domains
  55.     L0, L1, L2, L3 = integer*
  56.     numbers = integer*
  57.     X = integer
  58.     
  59. predicates
  60.  
  61.     nreverse(numbers, numbers).
  62.     concatenate(numbers, numbers, numbers).
  63.  
  64.  
  65. goal
  66.  
  67. write("\nTurbo Prolog benchmark program.  See comments in the source file."),
  68. write("\nC.Petersen - Compuserve 71046,1214, GENIE C.PETERSEN.\n"),
  69. time(H1,M1,S1,D1),
  70. nreverse([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
  71.     21,22,23,24,25,26,27,28,29,30],L),
  72. time(H2,M2,S2,D2),
  73. write("\nThe reversed list is:",L),
  74. write("\n\nStop time :",H2,":",M2,":",S2,".",D2),
  75. write("\nStart time:",H1,":",M1,":",S1,".",D1),
  76. Result=H2*3600-H1*3600+M2*60-M1*60+S2-S1+(D2-D1)/100,
  77. write("\nElapsed time:",Result," seconds"),
  78. write("\n\n").
  79.  
  80. clauses
  81.  
  82. nreverse([X|L0],L) :- nreverse(L0,L1),
  83.             concatenate(L1,[X],L).
  84.             
  85. nreverse([],[]).
  86.  
  87. concatenate([X|L1],L2,[X|L3]) :-
  88.             concatenate(L1,L2,L3).
  89.             
  90. concatenate([],L,L).